<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <ul>
            <template v-for="book in books">
                <li>书名：{{book.name}}</li>
                <li>作者：{{book.author}}</li>
            </template>
        </ul>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                books: [
                    {
                        name: '实战',
                        author: '芒果'
                    },
                    {
                        name: '语言精粹',
                        author: '芒果'
                    },
                    {
                        name: '高级程序设计',
                        author: '芒果'
                    }
                ]
            },
            computed: {
                filterBooks: function () {
                    return this.books.filter(function (book) {
                        return book.name.match(/JavaScript/);
                    });
                }
            }})
    </script>
</body>

</html>